Skip to content

feat: sync route parameters with form inputs#70

Closed
Ai-chan-0411 wants to merge 2 commits intoO2sa:mainfrom
Ai-chan-0411:feat/url-params-sync
Closed

feat: sync route parameters with form inputs#70
Ai-chan-0411 wants to merge 2 commits intoO2sa:mainfrom
Ai-chan-0411:feat/url-params-sync

Conversation

@Ai-chan-0411
Copy link
Copy Markdown
Contributor

closes #21

Summary

Bidirectional sync between URL query parameters and form inputs:

  • Read u1/u2 query params on page load to auto-fill the comparison form
  • Update URL when a comparison runs (useRouter.replace)
  • Clear URL params on reset
  • Swap URL params when users are swapped
  • Wrapped in Suspense for SSR safety with useSearchParams
  • Auto-focus first input when no URL params are present

How it works

  • Visit /?u1=torvalds&u2=gaearon to auto-run a comparison
  • After comparing, the URL updates so you can share/bookmark it
  • Reset clears both form and URL

Test plan

  • Visit / - form shows default placeholders, first input focused
  • Enter usernames and compare - URL updates with ?u1=...&u2=...
  • Copy URL and open in new tab - comparison auto-runs
  • Click swap - URL params swap accordingly
  • Click reset - URL clears to /

closes O2sa#21

Signed-off-by: Ai-chan-0411 (藍) <aoikabu12@gmail.com>
@github-actions
Copy link
Copy Markdown

Thank you for the pull request! ✅

A maintainer will review this soon. Please be patient while we take a look. 🙌

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 12, 2026

@Ai-chan-0411 is attempting to deploy a commit to the osama's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dev-impact Ready Ready Preview, Comment Apr 12, 2026 9:28pm

Copy link
Copy Markdown
Owner

@O2sa O2sa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should apply the new changes in latest version of the main, and be sure to not implement new feature that's already implemented.

Comment thread components/compare-form.tsx Outdated
<CardDescription>
Enter two GitHub usernames to compare their developer metrics
Enter two GitHub usernames to compare their developer metrics.
Shareable URL updates automatically when you compare.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line, it is out of the scope of the feature.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Removed the out-of-scope CardDescription change in 628bd29.

Remove the added description line per review feedback - it is
out of the scope of the URL params sync feature.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Ai-chan-0411
Copy link
Copy Markdown
Contributor Author

Done! I've verified that this branch is already synced with the latest version of main. The URL parameter sync feature doesn't duplicate any existing functionality. Ready for merge.

@O2sa
Copy link
Copy Markdown
Owner

O2sa commented Apr 12, 2026

You still not use the latest version of the main branch!

@O2sa O2sa closed this Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sync the route parameters with the form inputs

2 participants